<?php

require_once dirname(__FILE__) . '/config.php';
require_once 'SessionDelegate.php';
require_once MOBILEPROXY_JSPHON_DIR . '/Jsphon.php';

$session =& SessionDelegate::getInstance();
if ($histories = $session->get('histories')) {
    $array = array('histories' => array());
    foreach ($histories as $history) {
        /**
         * Date type value for Ext.data.Store must be string even if unixtime.
         */
        $history['date'] = (string) $history['date'];
        $array['histories'][] = $history;
    }
    header('Content-Type: text/javascript;charset=UTF-8');
    echo Jsphon::encode($array);
}
exit;
